﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace FlintSilverlight.Utils
{
	public static class Extensions
	{
		public static Point Subtract(this Point p1,Point p2)
		{
			return new Point(p1.X - p2.X, p1.Y - p2.Y);
		}

		public static int ToArgb(this Color color)
		{
			return (color.A << 24) | (color.R << 16) | (color.G << 8) | color.B;
		}

		public static Color ToColor(this int value)
		{
			return Color.FromArgb((byte)(value >> 24),
							 (byte)(value >> 16),
							 (byte)(value >> 8),
							 (byte)(value));
		}
	
		public static Color ToColor(this uint value)
		{
			return Color.FromArgb((byte)(value >> 24),
							 (byte)(value >> 16),
							 (byte)(value >> 8),
							 (byte)(value));
		}
	}
}
